local zhenggu =  fk.CreateSkill {
  name = "xiaobai__zhenggu"
}

Fk:loadTranslationTable{
  ["xiaobai__zhenggu"] = "铮骨",
  [":xiaobai__zhenggu"] = "当你造成或受到伤害时，你可以翻倍此伤害，然后直到伤害来源体力值发生变化或你死亡，"..
    "“铮骨”失效且其使用基本牌或锦囊牌只能指定你为目标。",

  ["@xiaobai__zhenggu"] = "铮骨",

  ["#xiaobai__zhenggu"] = "铮骨：是否翻倍此伤害"
}
local spec = {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(zhenggu.name) and target == player
  end,
  prompt = "#xiaobai__zhenggu",
  on_use = function (self, event, target, player, data)
    local room = player.room ---@type Room
    data:changeDamage(data.damage)
    room:setPlayerMark(data.from, "@xiaobai__zhenggu", player.id)
    room:invalidateSkill(player, zhenggu.name)
  end
}
zhenggu:addEffect(fk.DamageCaused, spec)
zhenggu:addEffect(fk.DamageInflicted, spec)

zhenggu:addEffect("prohibit", {
  is_delay_effect = true,
  is_prohibited = function (self, from, to, card)
    if (card.type == Card.TypeBasic or card:isCommonTrick()) and from:getMark("@xiaobai__zhenggu") ~= 0 then
      return to.id ~= from:getMark("@xiaobai__zhenggu")
    end
  end
})

zhenggu:addLoseEffect(function (self, player, is_death)
  local room = player.room
  for _, p in ipairs(room.alive_players) do
    if p:getMark("@xiaobai__zhenggu") then
      room:setPlayerMark(p, "@xiaobai__zhenggu", 0)
    end
  end
end)

zhenggu:addEffect(fk.HpChanged, {
  is_delay_effect = true,
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(zhenggu.name, true) and target:getMark("@xiaobai__zhenggu") ~= 0
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(target, "@xiaobai__zhenggu", 0)
    room:validateSkill(player, zhenggu.name)
  end
})

return zhenggu